<!-- @Author: Yu_Bo -->
<template>
	<view class="opinion">
		<view class="opinion_text">
			<u-input v-model="content" type="textarea" maxlength="100" height="300" :clearable="false" placeholder="请输入您的宝贵意见" :placeholder-style="placeholderStyle" />
		</view>
		<view class="opinion_txt">
			<view class="left">
				联系方式
			</view>
			<view class="right">
				<u-input v-model="mobile" type="number" :clearable="false" placeholder="请输入您的手机号" :placeholder-style="placeholderStyle" />
			</view>
		</view>
		<view class="opinion_txt">
			<view class="left">
				邮箱
			</view>
			<view class="right">
				<u-input v-model="mail" type="text" :clearable="false" placeholder="请输入您的邮箱" :placeholder-style="placeholderStyle" />
			</view>
		</view>
		<!-- 底部按钮 -->
		<c-footer>
			<view class="footer_btn">
				<view class="btn_txt color_right page_button" @click="submitBtn">
					<u-loading v-if="loading" mode="flower" color="#ffffff"></u-loading>
					提交
				</view>
			</view>
		</c-footer>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return{
				placeholderStyle: "color: #999999",
				// 
				content: "",
				mobile: "",
				mail: "",
				// 
				loading: false,
			}
		},
		computed: {},
		onLoad() {},
		onShow() {},
		methods: {
			submitBtn() {
				var that = this
				if(this.content == "") {
					that.$tips.showToast('请输入您的宝贵意见')
					return
				}
				if (that.mobile == '' || !that.$test.phoneTrue(that.mobile)) {
					that.$tips.showToast('请输入正确的手机号')
					return
				}
				if (that.mail == '' || !that.$u.test.email(that.mail)) {
					that.$tips.showToast('请输入正确的邮箱')
					return
				}
				if(that.loading) return
				that.loading = true
				var params = {
					content: that.content,
					mobile: that.mobile,
					mail: that.mail,
				}
				that.$httpApi.feedback(params).then((res) => {
					that.loading = false
					if (res.code == 1) {
						that.$tips.showToast(res.msg)
						setTimeout(() => {
							uni.navigateBack()
						}, 1500)
					}
				})
			}
		},
	}
</script>

<style lang='scss' scoped>
	.opinion {
		width: 100%;
		padding: 30rpx 30rpx;
		
		.opinion_text {
			width: 100%;
			margin-bottom: 30rpx;
			padding: 20rpx 30rpx;
			background: #F6F6F6;
			border-radius: 20rpx;
		}
		
		.opinion_txt {
			width: 100%;
			height: 112rpx;
			margin-bottom: 30rpx;
			padding: 0 30rpx;
			background: #F6F6F6;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			
			.left {
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
			}
			
			.right {
				width: 450rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 28rpx;
				color: #999999;
				display: flex;
				align-items: center;
				justify-content: flex-end;
				
				image {
					display: block;
					width: 28rpx;
					height: 28rpx;
					margin-left: 10rpx;
				}
				
				u-input {
					width: 100%;;
				}
				::v-deep .u-input{
					width: 100%;
					
					.u-input__input {
						width: 100%;
						text-align: right;
					}
				}
			}
		}
		
		.footer_btn {
			width: 100%;
			padding: 30rpx 30rpx;
			background: #fff;
			
			.btn_txt {
				width: 100%;
				height: 90rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 32rpx;
				color: #FFFFFF;
				border-radius: 45rpx;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}
</style>